class Solution:
    def countVowelStrings(self, n: int) -> int:
        dp = [1 for _ in range(6)]
        dp[0] = 0
        for i in range(1, n):
            newDp = [0 for _ in range(6)]
            curSum = sum(dp)
            cur = 0
            for j in range(1, 6):
                newDp[j] = curSum - cur
                cur += dp[j]
            dp = newDp

        return sum(dp)
